package com.cskaoyan.controller.topic;

import com.cskaoyan.model.vo.BaseRespVo;
import com.cskaoyan.model.vo.topic.WxTopicDetailVo;
import com.cskaoyan.model.vo.topic.WxTopicListVo;
import com.cskaoyan.model.vo.topic.WxTopicRelatedVo;
import com.cskaoyan.service.topic.WxTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: project-market
 * @description:
 * @author: zhijie
 * @create: 2021-12-02 19:28
 **/
@RestController
@RequestMapping("wx/topic")
public class WxTopicController {
    @Autowired
    WxTopicService wxTopicService;

    /**
     * 根据sort_order 升序显示 专题列表
     *
     * @param page
     * @param limit
     * @return
     */
    @GetMapping("list")
    public BaseRespVo topicList(Integer page, Integer limit) {
        WxTopicListVo data = wxTopicService.topicList(page, limit);
        return BaseRespVo.ok(data);
    }

    @GetMapping("detail")
    public BaseRespVo topicDetail(Integer id) {
        WxTopicDetailVo data = wxTopicService.topicDetail(id);
        return BaseRespVo.ok(data);
    }

    /**
     * 显示大于专题id的其他专题
     *
     * @param id
     * @return
     */
    @GetMapping("related")
    public BaseRespVo topicRelated(Integer id) {
        WxTopicRelatedVo data = wxTopicService.topicRelated(id);
        return BaseRespVo.ok(data);
    }
}
